import service from "@/utils/request";
import { AxiosPromise } from "axios";
import { competitionType,getCompetitionInfo} from "./type";
const { resourceService } = service;
/**
 * 管理员获取列表
 *
 */
export function getCompetitionList(data:getCompetitionInfo): AxiosPromise<any> {
  return resourceService({
    url: "/resource/competition/getPage",
    method: "get",
	params: data,
  });
}

// 竞赛信息上传
export function competitionAdd(
  competition: competitionType
): AxiosPromise<any> {
  return resourceService({
    url: "/resource/competition/add",
    method: "post",
    data: competition,
  });
}


// 竞赛信息删除
export function competitionDel (ids:number[]) : AxiosPromise<any> {
	return resourceService({
	  url: `/resource/competition/delete/${ids}`,
	  method: 'delete',
	});
}

// 根据id获取竞赛信息
export function getCompetitionById (id:number) : AxiosPromise<any> {
	return resourceService({
	  url: `/resource/competition/getById/${id}`,
	  method: 'get',
	});
}


// 修改竞赛信息
export function competitionUpdate (competition:competitionType) : AxiosPromise<any> {
	return resourceService({
	  url: `/resource/competition/update`,
	  method: 'put',
	  data:competition
	});
}


